package com.bootMybatis.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.springframework.core.io.ClassPathResource;

public class PropertiesUtil {

    public static String getPropertiesValue(String key) {
        Properties properties = readProperty();
        String value = properties.getProperty(key);
        return value;
    }

    private static Properties readProperty() {
        try {
            ClassPathResource classPathResource = new ClassPathResource("/sysConfig.properties");
            Properties properties = new Properties();
            InputStream inputStream = classPathResource.getInputStream();
            try {
                properties.load(inputStream);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return properties;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
